<!DOCTYPE html>

<html>
<head>
    <title>Singleton with mummy</title>
    <!--<script type="text/javascript" src="js/mummy.js" charset="utf-8"></script>-->
    <script type="text/javascript" src="js/mummy.js" charset="utf-8"></script>
</head>

<body>
<script type="text/javascript" charset="utf-8">
console.time("test");
Class({
    $define:function Human(){
        this.FirstName = "John";
        this.LastName = "Doe";
        
        this.Human = function(){
           
        }
        
        var self = this;
        if(Human.instance==null){
            Human.instance=self;
        }else{
            self = Human.instance;
        }
        return self;
    },
    
    $static:{
        
        instance:null
        
        /*
        getInstance:function(){
            if(Human.instance==null){
                Human.instance = $(Human).getNew();
            }
            return Human.instance;
        }
        */
    }
});

var Bob =  $(Human).getNew();
console.log("1-"+Bob.FirstName+" "+Bob.LastName);
Bob.FirstName = "Bob"; Bob.LastName = "Morane";
var Sam =   $(Human).getNew();
console.log("2-"+Sam.FirstName+" "+Sam.LastName);
Sam.FirstName = "Sam"; Sam.LastName = "LePirate";
console.log("3-"+Bob.FirstName+" "+Bob.LastName);
console.log("4-"+Sam.FirstName+" "+Sam.LastName);

var Sylvestre = $(Human).getNew();
console.log("5-"+Sylvestre.FirstName+" "+Sylvestre.LastName);
Sylvestre.FirstName = "Gros"; Sylvestre.LastName = "Minet";
console.log("6-"+Sam.FirstName+" "+Sam.LastName);
console.timeEnd("test");
</script>



</body>
</html>
